package com.ruoyi.web.wrapper;

import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.wrapper.BaseControllerWrapper;

import java.util.List;
import java.util.Map;

public class MerchantDataPushInfoWrapper extends BaseControllerWrapper {

    public MerchantDataPushInfoWrapper(Map<String, Object> single) {
        super(single);
    }

    public MerchantDataPushInfoWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    @Override
    public void wrapTheMap(Map<String, Object> map) {

        try {

            Long id = (Long) map.get("id");
            if (ObjectUtil.isNotEmpty(id)){
                map.put("id", id+"");
            }

            Long uid = (Long) map.get("uid");
            if (ObjectUtil.isNotEmpty(uid)){
                map.put("uid", uid+"");
            }

            String realname = (String) map.get("realname");
            if (ObjectUtil.isNotEmpty(realname)){
                map.put("realname", DesensitizedUtil.chineseName(realname));
            }

            String mobile = (String) map.get("mobile");
            if (ObjectUtil.isNotEmpty(mobile)){
                map.put("mobile", DesensitizedUtil.mobilePhone(mobile));
            }

        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
